package com.yangrd.helper.crudhelper.common;

import lombok.Data;
import lombok.RequiredArgsConstructor;
import org.springframework.data.domain.Page;

import java.util.List;

/**
 * description: AmisPage
 *
 * @author: yangrd
 * @date: 2020/9/14
 * @version: 1.0
 */
@RequiredArgsConstructor(staticName = "of")
@Data
public class AmisPage<T> {

    private final List<T> rows;

    private final Long count;

    public  static<T> AmisPage<T> of(Page<T> page){
        return AmisPage.of(page.getContent(), page.getTotalElements());
    }
}
